package main

import (
	"fmt"
	"log"
	"time"

	"image/color"
	_ "image/png"

	"gitee.com/yysama/Kindling_civilization/core/config"
	"gitee.com/yysama/Kindling_civilization/core/game"
	"gitee.com/yysama/Kindling_civilization/scence/loading"
	"gitee.com/yysama/Kindling_civilization/scence/maintown"
)

func main() {
	cfg, e := config.Load("../configs/cfg.json")
	if e != nil {
		log.Fatal(e)
	}

	app := game.Instance(cfg)

	load := loading.New()
	load.LastScence(maintown.New())

	go func(percent float64) {
		for ; percent <= 100; percent += 3 {
			load.Bar(percent).Tips(fmt.Sprintf("进度 %0.f %%", percent), color.RGBA{0xff, 0xff, 0xff, 0xff})
			time.Sleep(100 * time.Millisecond)
		}
	}(1)

	app.SetScence(load).Run()

	// maintown := maintown.New()
	// app.SetScence(maintown).Run()

}
